<?php

use App\Models\User;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('username', 20)->index()->comment('用户名');
            $table->string('password')->comment('密码');
            $table->string('avater')->comment('头像');
            $table->string('github_account')->default('')->comment('GitHub账号');
            $table->rememberToken();
            $table->timestamps();
        });

        User::create([
            'username'       => 'dzgrief',
            'password'       => bcrypt('123456'),
            'avater'         => '',
            'github_account' => 'https://github.com/dzgrief',
        ]);
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
